//package com.cww.study.config;
//
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.bind.annotation.RequestMethod;
//
//import javax.servlet.*;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
///**
// * @program: cww_project
// * @description:
// * @author: 陈亮
// * @create: 2022-03-15 22:17
// */
//@Configuration
//public class MyFilter implements Filter {
//
//    @Override
//    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
//        HttpServletResponse response1 = (HttpServletResponse) servletResponse;
//        HttpServletRequest request1 = (HttpServletRequest) servletRequest;
//        response1.setHeader("Access-Control-Allow-Origin", "*");
//        response1.setHeader("Access-Control-Allow-Credentials", "true");
//        response1.setHeader("Access-Control-Allow-Methods", "*");
//        response1.setHeader("Access-Control-Allow-Headers", "Content-Type,Access-Token");
//        response1.setHeader("Access-Control-Expose-Headers", "*");
//
//        if (request1.getMethod().equals( RequestMethod.OPTIONS.toString())){
//            System.out.println("-----检查------");
//            return;
//        }
//        filterChain.doFilter(servletRequest, servletResponse);
//    }
//}
